//
// Created by tang on 23-4-23.
//

#ifndef PIINFO_META_INFO_HPP
#define PIINFO_META_INFO_HPP

#include <unordered_map>

#include "parser/cursor.hpp"

#define DECLARE_KEY(K)  extern const char *const K
#define DEFINE_KEY(K) const char *const K = #K

DECLARE_KEY (All);
DECLARE_KEY (Fields);
DECLARE_KEY (Methods);
DECLARE_KEY (Skipped);
DECLARE_KEY (Include);
DECLARE_KEY (Enable);
DECLARE_KEY (Disable);
DECLARE_KEY (WhiteListFields);
DECLARE_KEY (WhiteListMethods);
DECLARE_KEY (Key);

#undef DECLARE_KEY

class MetaInfo {
public:
    MetaInfo(const Cursor &cursor);

    std::string property(const std::string &key) const;

    bool flag(const std::string &key) const;

private:
    using Property = std::pair<std::string, std::string>;

    std::unordered_map<std::string, std::string> properties_;

    std::vector<Property> extract_properties(const Cursor& cursor);
};

#endif  // PIINFO_META_INFO_HPP
